pipe calculation